cc.BaseClass =  cc.Class({
    extends: cc.Component,

    properties: {

    },

    start () {
        this.registerEvent();
    },

    registerEvent:function(){
        ClientNotify.register(CLIENT_NOTIFY_TYPE.CONNECT_DISCONNECT,this.onConnectDisconnect,this);       
    },

    onBtnClickCallBack:function(){
        this.playBtnClickEffect();
    },

    onTogClickCallBack:function(){
        this.playBtnClickEffect();
    },

    onCloseClick:function(){
        cc.log("========onCloseClick base=====");
        this.playBtnClickEffect();
        this.node.destroy();
    },

    //播放点击按钮音效
    playBtnClickEffect:function(){
        cc.log("========onBtnClickCallBack base=====");
    },

    playMoveAction:function(){
        this.node.scale = 0.2;
        var seq = cc.sequence(cc.scaleTo(0.1,1.1),cc.scaleTo(0.05,1));
        this.node.runAction(seq);
    },

    //发送心跳
    sendHeart: function(){
        this.unschedule(this.sendHeart);
        this.schedule(function(params) {
            HallEvent.sendHeart();
        }, 5);
    },

    onConnectDisconnect:function(data,target){
        var self = target;
        self.sendHeart && self.sendHeart();
    },

    onDestroy:function(){
        this.unschedule(this.sendHeart);
        ClientNotify.removeByType(CLIENT_NOTIFY_TYPE.CONNECT_DISCONNECT);
    }
});
